<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>location对象</title>
    <style>
        span {
            color: red;
        }
    </style>
</head>

<body>
    <a href="http://www.baidu.com">支付成功<span>5</span>秒之后跳转到首页</a>

    <script>
        const a = document.querySelector('a')
        let count = 5
        let timnerId = setInterval(() => {
            count--
            a.innerHTML = `支付成功<span>${count}</span>秒之后跳转到首页`
            if (count === 0) {
                clearInterval(timnerId)
                location.href = 'http://www.baidu.com'
            }
        }, 1000);

        // location.search 获取 url ？ 后的内容 例如 ？username=zhangsan&password=123456
        // location.hash 获取 url #后的内容 例如 #/my #/download
        // location.reload() 刷新页面，参数为true时强制刷新
    </script>
</body>

</html>